import MySQLdb

db = MySQLdb.connect(host="localhost", user="jimmy", passwd="Ahbh37-4ta", db="twitter")

cur = db.cursor() 

fd = open("numeric2screen", "r")

line = fd.readline().strip()

while line:
	#try:
		id, screenname = line.split(' ', 1)
		cur.execute("""INSERT INTO user_id_screenname (user_id, screenname) VALUES (%s,%s)""", (id, screenname))
		#db.commit()
		line = fd.readline().strip()
	#except:     
	#	db.rollback()

fd.close()
cur.close()
db.close()
